package work6;

import java.util.Scanner;

public class Quetion1 {
    public static void main(String[] args) {
        System.out.println("====== 矩形对象 ======");
        Scanner input = new Scanner(System.in);
        while (true) {
            System.out.println("请输入长和宽");
            double l, w;
            l = input.nextDouble();
            if (l == 0) {
                break;
            }
            w = input.nextDouble();
            Rectangle r = new Rectangle(l, w);
            System.out.printf("构造了长为%.2f、宽为%.2f的矩形，面积为%.2f，周长为%.2f\n", r.length, r.width, r.Area(), r.Perimeter());
        }
        input.close();
        System.out.println("====== 程序结束 ======");
    }
}

